import request from '@/util/request'

export function logintrace(data: any) {
	return request({
		url: '/ztIot/Logintrace',
		method: 'post',
		data: data,
		isToken: true
	})
}

export function getOpenId(req: any) {
	return request({
		url: `/wechat/getOpenId/${req.code}`,
		method: 'get',
		isToken: true
	})
}

export function getLogintraceList(req: any) {
	return request({
		url: '/ztIot/Logintrace/list',
		method: 'get',
		params: req,
		isToken: true
	})
}

export function deleteLogintrace(req: any) {
	return request({
		url: `/ztIot/Logintrace/${req.id}`,
		method: 'delete',
		isToken: true
	})
}

// ----------------

// 设备列表
export function getInsecticidalLampDeviceList(req: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampDevice/list`,
		method: 'get',
		params: req,
		isToken: true
	})
}

// 设备详情
export function getInsecticidalLampDevice(req: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampDevice/${req.id}`,
		method: 'get',
		isToken: true
	})
}

// 修改设备详情
export function updateInsecticidalLampDevice(data: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampDevice`,
		method: 'put',
		data: data,
		isToken: true
	})
}

// 绑定设备
export function bindingInsecticidalLampDevice(req: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampDevice/binding/${req.bindingCode}`,
		method: 'get',
		isToken: true
	})
}

// 项目列表
export function getInsecticidalLampProjectList(req: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampProject/list`,
		method: 'get',
		params: req,
		isToken: true
	})
}

// 新增项目
export function addInsecticidalLampProject(data: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampProject`,
		method: 'post',
		data: data,
		isToken: true
	})
}

// 修改项目
export function updateInsecticidalLampProject(data: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampProject`,
		method: 'put',
		data: data,
		isToken: true
	})
}

// 绑定项目设备
export function bindingDevices(data: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampProject/bindingDevices`,
		method: 'post',
		data: data,
		isToken: true
	})
}

// 移出设备
export function remProjectDevice(req: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampProject/remProjectDevice/${req.id}/${req.deviceId}`,
		method: 'get',
		isToken: true
	})
}

// 删除项目
export function deleteInsecticidalLampProject(req: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampProject/${req.id}`,
		method: 'delete',
		isToken: true
	})
}

// 未绑定设备列表
export function getUnBindingList(req: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampDevice/unBindingList`,
		method: 'get',
		params: req,
		isToken: true
	})
}

// 未绑定项目设备列表
export function getUnBindingProjectList(req: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampDevice/unBindingProjectList`,
		method: 'get',
		params: req,
		isToken: true
	})
}

// 首页报表汇总
export function getIndexReport(req: any) {
	return request({
		url: `/insecticidalLamp/index/indexReport`,
		method: 'get',
		isToken: true
	})
}

// 首页趋势图
export function getLampReportTrend(data: any) {
	return request({
		url: `/insecticidalLamp/index/lampReportTrend`,
		method: 'post',
		data: data,
		isToken: true
	})
}

// 命令控制
export function commandInsecticidalLampDevice(data: any) {
	return request({
		url: `/insecticidalLamp/insecticidalLampDevice/command`,
		method: 'post',
		data: data,
		isToken: true
	})
}

// 首页控制按钮
export function getIndexControl(req: any) {
	return request({
		url: `/insecticidalLamp/index/indexControl`,
		method: 'get',
		params: req,
		isToken: true
	})
}

// 登录
export function login(data: any) {
	return request({
		url: `/insecticidalLamp/login`,
		method: 'post',
		data: data,
		isToken: true
	})
}

// 注册
export function register(data: any) {
	return request({
		url: `/register`,
		method: 'post',
		data: data,
		isToken: true
	})
}

// 修改用户信息
export function profile(data: any) {
	return request({
		url: `/system/user/profile`,
		method: 'put',
		data: data,
		isToken: true
	})
}

// 查询设备批量命令记录列表
export function getDeviceBatchCmdList(req: any) {
	return request({
		url: `/ztIot/deviceBatchCmd/list`,
		method: 'get',
		params: req,
		isToken: true
	})
}

// 查询设备批量执行命令记录列表
export function getDeviceBatchCmdLogList(req: any) {
	return request({
		url: `/ztIot/deviceBatchCmdLog/list`,
		method: 'get',
		params: req,
		isToken: true
	})
}













